import uuidv1 from "uuid/v1";

let zz = {
  watch: {},
  methods: {
    jinrong() {
      this.$store.state.daping.threecom = this;
      this.$store.state.daping.scencetype = "gongre";
      // this.$store.state.daping.scencetype = "nengxiao";
      //初始化数据操作
      //   this.catchtydata();
      //全局pick事件
        this.initother();

      this.cardwuxiobj = {};

      this.$root._earth.sceneTree.$refs["cardwarn"].czmObject.positions.map(
        item => {
          // console.log(item);

          let uuid = uuidv1();
          this.$root._earth.sceneTree.root.children.push({
            ref: uuid,
            czmObject: {
              name: "Pin|diandia|" + uuid,
              xbsjType: "Pin",
              position: [item[0], item[1], item[2]],
              near: 300,
              // show: true,
              scale: 0.6,
              imageUrl: "/configuration/ziyuan/dian.png"
            }
          });

          this.cardwuxiobj[uuid] = {}
          this.cardwuxiobj[uuid]['position'] = [item[0], item[1], item[2]]
        }
      );

      this.$root._earth.sceneTree.$refs["cardxunjian"].czmObject.positions.map(
        item => {
          // console.log(item);

          let uuid = uuidv1();
          this.$root._earth.sceneTree.root.children.push({
            ref: uuid,
            czmObject: {
              name: "Pin|chedia|" + uuid,
              xbsjType: "Pin",
              position: [item[0], item[1], item[2]],
              near: 300,
              // show: true,
              scale: 0.6,
              imageUrl: "/configuration/ziyuan/che.png"
            }
          });

          this.cardwuxiobj[uuid] = {}
          this.cardwuxiobj[uuid]['position'] = [item[0], item[1], item[2]]
        }
      );

      // this.$root._earth.sceneTree.$refs["cardxunjian"].czmObject.positions.map(
      //   item => {
      //     // console.log(item);
      //     this.cardnew.push({
      //       uid: uuidv1(),
      //       type: "xunjiancard",
      //       position: [item[0], item[1], item[2]]
      //     });
      //   }
      // );

      // this.$root._earth.sceneTree.$refs["reyonghucard"].czmObject.positions.map(
      //   item => {
      //     // console.log(item);
      //     this.cardnew.push({
      //       uid: uuidv1(),
      //       type: "reyonghucard",
      //       position: [item[0], item[1], item[2]]
      //     });
      //   }
      // );
    }
  }
};

export default zz;
